##
#
# @file
#
# @brief Configure script of LibBSP for the LPC24XX boards.
#

AC_PREREQ([2.69])
AC_INIT([rtems-c-src-lib-libbsp-arm-lpc24xx],[_RTEMS_VERSION],[https://devel.rtems.org/newticket])
AC_CONFIG_SRCDIR([bsp_specs])
RTEMS_TOP(../../../../../..)

RTEMS_CANONICAL_TARGET_CPU
AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.12.2])
RTEMS_BSP_CONFIGURE

RTEMS_PROG_CC_FOR_TARGET
RTEMS_CANONICALIZE_TOOLS
RTEMS_PROG_CCAS

RTEMS_CHECK_NETWORKING
AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")

RTEMS_BSPOPTS_SET([LPC24XX_OSCILLATOR_MAIN],[lpc23*],[3686400U])
RTEMS_BSPOPTS_SET([LPC24XX_OSCILLATOR_MAIN],[*],[12000000U])
RTEMS_BSPOPTS_HELP([LPC24XX_OSCILLATOR_MAIN],[main oscillator frequency in Hz])

RTEMS_BSPOPTS_SET([LPC24XX_OSCILLATOR_RTC],[*],[32768U])
RTEMS_BSPOPTS_HELP([LPC24XX_OSCILLATOR_RTC],[RTC oscillator frequency in Hz])

RTEMS_BSPOPTS_SET([LPC24XX_CCLK],[lpc17xx_ea* | lpc40xx_ea*],[96000000U])
RTEMS_BSPOPTS_SET([LPC24XX_CCLK],[lpc23*],[58982400U])
RTEMS_BSPOPTS_SET([LPC24XX_CCLK],[lpc24xx_plx800_*],[51612800U])
RTEMS_BSPOPTS_SET([LPC24XX_CCLK],[*],[72000000U])
RTEMS_BSPOPTS_HELP([LPC24XX_CCLK],[CPU clock in Hz])

RTEMS_BSPOPTS_SET([LPC24XX_PCLKDIV],[lpc17xx_ea* | lpc40xx_ea*],[2U])
RTEMS_BSPOPTS_SET([LPC24XX_PCLKDIV],[*],[1U])
RTEMS_BSPOPTS_HELP([LPC24XX_PCLKDIV],[clock divider for default PCLK (PCLK = CCLK / PCLKDIV)])

RTEMS_BSPOPTS_SET([LPC24XX_EMCCLKDIV],[lpc17xx_ea* | lpc40xx_ea*],[2U])
RTEMS_BSPOPTS_SET([LPC24XX_EMCCLKDIV],[*],[1U])
RTEMS_BSPOPTS_HELP([LPC24XX_EMCCLKDIV],[clock divider for EMCCLK (EMCCLK = CCLK / EMCCLKDIV)])

RTEMS_BSPOPTS_SET([LPC24XX_UART_BAUD],[*],[115200U])
RTEMS_BSPOPTS_HELP([LPC24XX_UART_BAUD],[baud for UARTs])

RTEMS_BSPOPTS_SET([LPC24XX_ETHERNET_RMII],[*_ea_*],[1])
RTEMS_BSPOPTS_SET([LPC24XX_ETHERNET_RMII],[*],[])
RTEMS_BSPOPTS_HELP([LPC24XX_ETHERNET_RMII],[enable RMII for Ethernet])

RTEMS_BSPOPTS_SET([LPC24XX_PIN_ETHERNET_POWER_DOWN],[*],[])
RTEMS_BSPOPTS_HELP([LPC24XX_PIN_ETHERNET_POWER_DOWN],[optional Ethernet power-down pin, output is set to high to enable power])

RTEMS_BSPOPTS_SET([LPC24XX_EMC_MT48LC4M16A2],[lpc24xx_ncs_rom_*],[1])
RTEMS_BSPOPTS_HELP([LPC24XX_EMC_MT48LC4M16A2],[enable Micron MT48LC4M16A2 configuration for EMC])

RTEMS_BSPOPTS_HELP([LPC24XX_EMC_W9825G2JB75I],[enable Winbond W9825G2JB75I configuration for EMC])

RTEMS_BSPOPTS_SET([LPC24XX_EMC_IS42S32800D7],[*_plx800_rom_*],[1])
RTEMS_BSPOPTS_HELP([LPC24XX_EMC_IS42S32800D7],[enable ISSI IS42S32800D7 configuration for EMC])

RTEMS_BSPOPTS_SET([LPC24XX_EMC_IS42S32800B],[lpc17xx_ea_rom_* | lpc40xx_ea_rom_*],[1])
RTEMS_BSPOPTS_HELP([LPC24XX_EMC_IS42S32800B],[enable ISSI IS42S32800B configuration for EMC])

RTEMS_BSPOPTS_SET([LPC24XX_EMC_M29W160E],[lpc24xx_ncs_rom_*],[1])
RTEMS_BSPOPTS_HELP([LPC24XX_EMC_M29W160E],[enable M29W160E configuration for EMC])

RTEMS_BSPOPTS_SET([LPC24XX_EMC_M29W320E70],[*_plx800_rom_*],[1])
RTEMS_BSPOPTS_HELP([LPC24XX_EMC_M29W320E70],[enable M29W320E70 configuration for EMC])

RTEMS_BSPOPTS_HELP([LPC24XX_EMC_SST39VF3201],[enable SST39VF3201 configuration for EMC])

RTEMS_BSPOPTS_SET([LPC24XX_EMC_TEST],[*],[])
RTEMS_BSPOPTS_HELP([LPC24XX_EMC_TEST],[enable tests for EMC])

RTEMS_BSPOPTS_SET([LPC24XX_CONFIG_CONSOLE],[*],[0])
RTEMS_BSPOPTS_HELP([LPC24XX_CONFIG_CONSOLE],[configuration for console (UART 0)])

RTEMS_BSPOPTS_SET([LPC24XX_CONFIG_UART_1],[*_plx800_*],[0])
RTEMS_BSPOPTS_HELP([LPC24XX_CONFIG_UART_1],[configuration for UART 1])

RTEMS_BSPOPTS_SET([LPC24XX_CONFIG_UART_2],[lpc23*],[0])
RTEMS_BSPOPTS_SET([LPC24XX_CONFIG_UART_2],[lpc24xx_ncs_*],[0])
RTEMS_BSPOPTS_SET([LPC24XX_CONFIG_UART_2],[*_plx800_*],[0])
RTEMS_BSPOPTS_HELP([LPC24XX_CONFIG_UART_2],[configuration for UART 2])

RTEMS_BSPOPTS_SET([LPC24XX_CONFIG_UART_3],[lpc23*],[0])
RTEMS_BSPOPTS_SET([LPC24XX_CONFIG_UART_3],[lpc24xx_ncs_*],[0])
RTEMS_BSPOPTS_HELP([LPC24XX_CONFIG_UART_3],[configuration for UART 3])

RTEMS_BSPOPTS_SET([LPC24XX_CONFIG_I2C_0],[lpc24xx_ncs_*],[0])
RTEMS_BSPOPTS_HELP([LPC24XX_CONFIG_I2C_0],[configuration for I2C 0])

RTEMS_BSPOPTS_SET([LPC24XX_CONFIG_I2C_1],[lpc24xx_ncs_*],[1])
RTEMS_BSPOPTS_HELP([LPC24XX_CONFIG_I2C_1],[configuration for I2C 1])

RTEMS_BSPOPTS_SET([LPC24XX_CONFIG_I2C_2],[*],[])
RTEMS_BSPOPTS_HELP([LPC24XX_CONFIG_I2C_2],[configuration for I2C 2])

RTEMS_BSPOPTS_SET([LPC24XX_HEAP_EXTEND],[lpc23*],[1])
RTEMS_BSPOPTS_HELP([LPC24XX_HEAP_EXTEND],[enable heap extend by Ethernet and USB regions])

RTEMS_BSPOPTS_SET([LPC24XX_STOP_GPDMA],[*],[1])
RTEMS_BSPOPTS_HELP([LPC24XX_STOP_GPDMA],[stop general purpose DMA at start-up to avoid DMA interference])

RTEMS_BSPOPTS_SET([LPC24XX_STOP_ETHERNET],[lpc23*],[])
RTEMS_BSPOPTS_SET([LPC24XX_STOP_ETHERNET],[*],[1])
RTEMS_BSPOPTS_HELP([LPC24XX_STOP_ETHERNET],[stop Ethernet controller at start-up to avoid DMA interference])

RTEMS_BSPOPTS_SET([LPC24XX_STOP_USB],[lpc23*],[])
RTEMS_BSPOPTS_SET([LPC24XX_STOP_USB],[*],[1])
RTEMS_BSPOPTS_HELP([LPC24XX_STOP_USB],[stop USB controller at start-up to avoid DMA interference])

RTEMS_BSPOPTS_SET([LPC_DMA_CHANNEL_COUNT],[lpc17* | lpc40*],[8])
RTEMS_BSPOPTS_SET([LPC_DMA_CHANNEL_COUNT],[*],[2])
RTEMS_BSPOPTS_HELP([LPC_DMA_CHANNEL_COUNT],[DMA channel count])

RTEMS_BSPOPTS_SET([BSP_START_RESET_VECTOR],[lpc24xx_ncs_rom_ext],[0x80000040])
RTEMS_BSPOPTS_HELP([BSP_START_RESET_VECTOR],[reset vector address for BSP start])

RTEMS_BSPOPTS_SET([BSP_USB_OTG_TRANSCEIVER_I2C_ADDR],[lpc17xx_ea* | lpc40xx_ea*],[(0x2f << 1)])
RTEMS_BSPOPTS_HELP([BSP_USB_OTG_TRANSCEIVER_I2C_ADDR],[USB OTG transceiver I2C address used by USB stack])

RTEMS_BSP_CLEANUP_OPTIONS(0, 1)
RTEMS_BSP_LINKCMDS

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
